package com.dajie.pt.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.dajie.pt.dao.EdmCorpReviewDao;
import com.dajie.pt.entity.base.EntityDao;
import com.dajie.pt.model.EdmCorpReviewInfo;
import com.dajie.pt.service.EdmCorpReviewService;
import com.dajie.pt.service.base.BaseServiceImpl;

@Component
public class EdmCorpReviewServiceImpl extends BaseServiceImpl<EdmCorpReviewInfo, Integer> implements
			EdmCorpReviewService<EdmCorpReviewInfo, Integer>
{
	@Autowired
	EdmCorpReviewDao edmCorpReviewDao;
	
	@Override
	public EdmCorpReviewInfo getEdmCorpReviewByCorpId(Integer corpId,Integer status) {
		Map map=new HashMap();
		map.put("corpid", corpId);
		map.put("status", status);	
		Object o=this.edmCorpReviewDao.getEdmCorpReviewInfoByCorpId(map);
		return o!=null?(EdmCorpReviewInfo)o:null;
		
	}


	@Override
	public EntityDao<EdmCorpReviewInfo, Integer> getEntityDao() {
		return this.edmCorpReviewDao;
	}

	@Override
	public void updateEdmCorpReviewYesByCorpId(Integer corpId,Integer status) {
		Map map=new HashMap();
		map.put("corpid", corpId);
		map.put("status", status);
		edmCorpReviewDao.updateEdmCorpReviewYesByCorpId(map);
		
	}

	@Override
	public void updateEdmCorpReviewNoByCorpId(Integer corpId,Integer status) {
		Map map=new HashMap();
		map.put("corpid", corpId);
		map.put("status", status);
		edmCorpReviewDao.updateEdmCorpReviewNoByCorpId(map);
		
	}


	@Override
	public void insertEdmCorpReviewNumByCorpId(Integer corpId,Integer status) {
		Map map=new HashMap();
		map.put("corpid", corpId);
		map.put("status", status);
		if(status==0){
			map.put("yes", 2485);
			map.put("no", 452);
		}
		if(status==1){
			map.put("yes", 476);
			map.put("no",2024);
		}
		edmCorpReviewDao.insertEdmCorpReviewNumByCorpId(map);
	}



	

	
}
